package misc;

import java.sql.Time;

public class Util{	
	@SuppressWarnings("deprecation")
	public static long timeToSeconds(Time time){
		long seconds = 0;
		seconds += time.getHours() * 60 * 60;
		seconds += time.getMinutes() * 60;
		seconds += time.getSeconds();
		
		return seconds;
	}
	
    public static String miliToTime(long mili){
    	if(mili > 1000){
    		float time = 0;
        	String hora = "00";
        	String minuto = "00";
        	String segundo = "00";
        	
    		time = (float)(mili/1000.0/60.0/60.0);
    		if(time > 0){
    			if(time < 10){
    				hora = "0" + (int)(time);
    			}else{
    				hora = "" + (int)(time);
    			}    			
    		}
    		
    		time = time%1*60;
    		if(time > 0){
    			if(time < 10){
    				minuto = "0" + (int)(time);
    			}else{
    				minuto = "" + (int)(time);
    			}
    		}
    		
    		time = time%1*60;
    		if(time > 0){
    			if(time < 10){
    				segundo = "0" + (int)(time);
    			}else{
    				segundo = "" + (int)(time);
    			}
    		}
    		
    		return hora + ":" + minuto + ":" + segundo;
    	}else{
    		return "00:00:00";
    	}
    }
}